<script>
	import Vue from 'vue'
	export default {
		globalData: {
		    // 全局设置状态栏和导航栏高度
		    statusBarH: 0,
		    customBarH: 0,
			platform: '',
			systemLevel: '',
			equipmentNumber: '',
			userInfo: {},
			canlisten:false,
			appinfo:{}
		},
        onLaunch: function() {
            uni.getSystemInfo({
                success: (e) => {
                    // 获取手机状态栏高度
                    let statusBar = e.statusBarHeight
                    let customBar
                    
                    // #ifndef MP
                    customBar = statusBar + (e.platform == 'android' ? 50 : 45)
                    // #endif
                    
                    // #ifdef MP-WEIXIN
                    // 获取胶囊按钮的布局位置信息
                    let menu = wx.getMenuButtonBoundingClientRect()
                    // 导航栏高度 = 胶囊下距离 + 胶囊上距离 - 状态栏高度
                    customBar = menu.bottom + menu.top - statusBar
                    // #endif
                    
                    // #ifdef MP-ALIPAY
                    customBar = statusBar + e.titleBarHeight
                    // #endif
                    
                    // 注意：此方法不支持原生Nvue页面
                    Vue.prototype.statusBarH = statusBar
                    Vue.prototype.customBarH = customBar
                    
                    // 支持nvue页面写法（兼容H5/小程序/APP/APP-Nvue）
                    this.globalData.statusBarH = statusBar
                    this.globalData.customBarH = customBar
                }
            })
			//获取配置信息
			this.$u.api.getConfig({
				key: 'open_app_name,open_app_logo,open_app_download_qr,open_app_download_url,open_app_summary,open_customer_wx',
			}).then((res) => {
				debugger
				if (res.code == 200){
					var info = {};
					info.appName = res.data.open_app_name;
					info.logo = res.data.open_app_logo;
					info.downloadQr = res.data.open_app_download_qr;
					info.download = res.data.open_app_download_url;
					info.appSummary = res.data.open_app_summary;
					info.open_customer_wx = res.data.open_customer_wx;
					this.globalData.appinfo = info;
					this.$u.vuex('appInfo',  info);
				}
			})
        },
		onShow: function() {
			// #ifdef APP-PLUS
			if (uni.getSystemInfoSync().platform == 'android') {
				debugger
				console.info(plus.push.getClientInfo().clientid)
				var clientid = plus.push.getClientInfo().clientid;
				console.info(clientid);
				if(this.$utils.isNotEmpty(this.$store.state.vuex_user.userId)){
					this.$u.api.user.bindDevice({'clientId':this.clientId}).then(res => {
					});
				}
			}
			//#endif
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style lang="scss">
	/* 注意要写在第一行，同时给style标签加入lang="scss"属性 */
	@import "uview-ui/index.scss";
	@import url('./static/css/iconfont.css');
	page{
		background: $mh-bg-color;
	}
	.defImg {
		display: flex;
		align-items: center;
		justify-content: center;
	}
	
	.defImg>image {
		width: 100%;
		height: 100%;
	}
	
	.vertical-center{
		display: flex;
		align-items: center;
		justify-content: center;
	}
	.standard-center{
		display: flex;
		justify-content: space-between;
		box-sizing: border-box;
	}
	.rowCenter{
		display: flex;
		align-items: center;
		justify-content: center;
	}
	.rowRanges{
		display: flex;
		align-items: center;
		justify-content: center;
	}
	.rowRangeAve{
		display: flex;
		align-items: center;
		justify-content: space-between;
	}
	.borderBox {
		box-sizing: border-box;
	}
	.nav-height{
		height: 88px;
	}
	.split-line{
		background: #E5E5E5;
		width: 100%;
		height: 2px;
	}
	.split-line-20{
		background: #E5E5E5;
		width: 100%;
		height: 20px;
	}
	.split-line-1{
		background: #E5E5E5;
		width: 100%;
		height: 1px;
	}
	.split-line-10{
		background: #E5E5E5;
		width: 100%;
		height: 10px;
	}
	.bank-line{
		height: 20px;
		width: 100%;
	}
	.mb-5{
		margin-bottom: 5px;
	}
	.mb-10{
		margin-bottom: 10px;
	}
	.mb-20{
		margin-bottom: 20px;
	}
	.mr-10{
		margin-right: 10px;
	}
	.top {
		display: flex;
		width: 100%;
		height: var(--status-bar-height);
		background-color: transparent;
	}
</style>